Imports CrystalDecisions.CrystalReports
Imports System.Drawing
Imports System.Drawing.Printing
Imports System.Text
Imports System
Imports System.Collections
Imports System.Management
Imports System.IO
Imports System.ComponentModel
Imports System.Windows.Forms
Imports System.Configuration


Public Class PosSalesSumamryRpt
    Inherits System.Windows.Forms.Form

#Region " Windows Form Designer generated code "

    Public Sub New()
        MyBase.New()

        'This call is required by the Windows Form Designer.
        InitializeComponent()

        'Add any initialization after the InitializeComponent() call

    End Sub

    'Form overrides dispose to clean up the component list.
    Protected Overloads Overrides Sub Dispose(ByVal disposing As Boolean)
        If disposing Then
            If Not (components Is Nothing) Then
                components.Dispose()
            End If
        End If
        MyBase.Dispose(disposing)
    End Sub

    'Required by the Windows Form Designer
    Private components As System.ComponentModel.IContainer

    'NOTE: The following procedure is required by the Windows Form Designer
    'It can be modified using the Windows Form Designer.  
    'Do not modify it using the code editor.
    Friend WithEvents dgProduct As System.Windows.Forms.DataGrid
    Friend WithEvents Label1 As System.Windows.Forms.Label
    Friend WithEvents GroupBox1 As System.Windows.Forms.GroupBox
    Friend WithEvents rbSale As System.Windows.Forms.RadioButton
    Friend WithEvents rbReturn As System.Windows.Forms.RadioButton
    Friend WithEvents rbGv As System.Windows.Forms.RadioButton
    Friend WithEvents rbAll As System.Windows.Forms.RadioButton
    Friend WithEvents Label2 As System.Windows.Forms.Label
    Friend WithEvents label4 As System.Windows.Forms.Label
    Friend WithEvents Label3 As System.Windows.Forms.Label
    Friend WithEvents tbTerminal As System.Windows.Forms.TextBox
    Friend WithEvents tbFromDate As System.Windows.Forms.DateTimePicker
    Friend WithEvents tbToDate As System.Windows.Forms.DateTimePicker
    Friend WithEvents Label13 As System.Windows.Forms.Label
    Friend WithEvents Label14 As System.Windows.Forms.Label
    Friend WithEvents Label15 As System.Windows.Forms.Label
    Friend WithEvents Label16 As System.Windows.Forms.Label
    Friend WithEvents Label17 As System.Windows.Forms.Label
    Friend WithEvents Label18 As System.Windows.Forms.Label
    Friend WithEvents tbCash As System.Windows.Forms.TextBox
    Friend WithEvents tbCredit As System.Windows.Forms.TextBox
    Friend WithEvents tbCheque As System.Windows.Forms.TextBox
    Friend WithEvents tbKnet As System.Windows.Forms.TextBox
    Friend WithEvents tbCard As System.Windows.Forms.TextBox
    Friend WithEvents tbGV As System.Windows.Forms.TextBox
    Friend WithEvents PrintDialog1 As System.Windows.Forms.PrintDialog
    Friend WithEvents cmbShowroom As DevComponents.DotNetBar.Controls.ComboBoxEx
    Friend WithEvents cmdPrint As DevComponents.DotNetBar.ButtonX
    Friend WithEvents cmdRefresh As DevComponents.DotNetBar.ButtonX
    Friend WithEvents cmdExit As DevComponents.DotNetBar.ButtonX
    Friend WithEvents GroupPanel1 As DevComponents.DotNetBar.Controls.GroupPanel
    Friend WithEvents retailDetialSales1 As RetailDetialSales
    <System.Diagnostics.DebuggerStepThrough()> Private Sub InitializeComponent()
        Me.dgProduct = New System.Windows.Forms.DataGrid()
        Me.Label1 = New System.Windows.Forms.Label()
        Me.tbFromDate = New System.Windows.Forms.DateTimePicker()
        Me.GroupBox1 = New System.Windows.Forms.GroupBox()
        Me.rbGv = New System.Windows.Forms.RadioButton()
        Me.rbReturn = New System.Windows.Forms.RadioButton()
        Me.rbSale = New System.Windows.Forms.RadioButton()
        Me.rbAll = New System.Windows.Forms.RadioButton()
        Me.tbToDate = New System.Windows.Forms.DateTimePicker()
        Me.Label2 = New System.Windows.Forms.Label()
        Me.label4 = New System.Windows.Forms.Label()
        Me.Label3 = New System.Windows.Forms.Label()
        Me.tbTerminal = New System.Windows.Forms.TextBox()
        Me.Label13 = New System.Windows.Forms.Label()
        Me.tbCash = New System.Windows.Forms.TextBox()
        Me.Label14 = New System.Windows.Forms.Label()
        Me.tbCredit = New System.Windows.Forms.TextBox()
        Me.Label15 = New System.Windows.Forms.Label()
        Me.tbCheque = New System.Windows.Forms.TextBox()
        Me.Label16 = New System.Windows.Forms.Label()
        Me.tbKnet = New System.Windows.Forms.TextBox()
        Me.Label17 = New System.Windows.Forms.Label()
        Me.tbCard = New System.Windows.Forms.TextBox()
        Me.Label18 = New System.Windows.Forms.Label()
        Me.tbGV = New System.Windows.Forms.TextBox()
        Me.PrintDialog1 = New System.Windows.Forms.PrintDialog()
        Me.retailDetialSales1 = New RetailDetialSales()
        Me.cmbShowroom = New DevComponents.DotNetBar.Controls.ComboBoxEx()
        Me.cmdPrint = New DevComponents.DotNetBar.ButtonX()
        Me.cmdRefresh = New DevComponents.DotNetBar.ButtonX()
        Me.cmdExit = New DevComponents.DotNetBar.ButtonX()
        Me.GroupPanel1 = New DevComponents.DotNetBar.Controls.GroupPanel()
        CType(Me.dgProduct, System.ComponentModel.ISupportInitialize).BeginInit()
        Me.GroupBox1.SuspendLayout()
        Me.GroupPanel1.SuspendLayout()
        Me.SuspendLayout()
        '
        'dgProduct
        '
        Me.dgProduct.BackColor = System.Drawing.Color.AliceBlue
        Me.dgProduct.BackgroundColor = System.Drawing.Color.AliceBlue
        Me.dgProduct.BorderStyle = System.Windows.Forms.BorderStyle.FixedSingle
        Me.dgProduct.CaptionVisible = False
        Me.dgProduct.DataMember = ""
        Me.dgProduct.HeaderBackColor = System.Drawing.Color.FromArgb(CType(CType(255, Byte), Integer), CType(CType(192, Byte), Integer), CType(CType(128, Byte), Integer))
        Me.dgProduct.HeaderForeColor = System.Drawing.SystemColors.ControlText
        Me.dgProduct.Location = New System.Drawing.Point(13, 84)
        Me.dgProduct.Name = "dgProduct"
        Me.dgProduct.ReadOnly = True
        Me.dgProduct.Size = New System.Drawing.Size(971, 431)
        Me.dgProduct.TabIndex = 47
        '
        'Label1
        '
        Me.Label1.AutoSize = True
        Me.Label1.BackColor = System.Drawing.Color.Transparent
        Me.Label1.ForeColor = System.Drawing.SystemColors.ActiveCaptionText
        Me.Label1.Location = New System.Drawing.Point(9, 4)
        Me.Label1.Name = "Label1"
        Me.Label1.Size = New System.Drawing.Size(72, 18)
        Me.Label1.TabIndex = 55
        Me.Label1.Text = "From Date"
        '
        'tbFromDate
        '
        Me.tbFromDate.Format = System.Windows.Forms.DateTimePickerFormat.[Short]
        Me.tbFromDate.Location = New System.Drawing.Point(13, 49)
        Me.tbFromDate.Name = "tbFromDate"
        Me.tbFromDate.Size = New System.Drawing.Size(93, 26)
        Me.tbFromDate.TabIndex = 153
        '
        'GroupBox1
        '
        Me.GroupBox1.BackColor = System.Drawing.Color.Transparent
        Me.GroupBox1.Controls.Add(Me.rbGv)
        Me.GroupBox1.Controls.Add(Me.rbReturn)
        Me.GroupBox1.Controls.Add(Me.rbSale)
        Me.GroupBox1.Controls.Add(Me.rbAll)
        Me.GroupBox1.Location = New System.Drawing.Point(485, 10)
        Me.GroupBox1.Name = "GroupBox1"
        Me.GroupBox1.Size = New System.Drawing.Size(290, 44)
        Me.GroupBox1.TabIndex = 154
        Me.GroupBox1.TabStop = False
        '
        'rbGv
        '
        Me.rbGv.AutoSize = True
        Me.rbGv.BackColor = System.Drawing.Color.Transparent
        Me.rbGv.ForeColor = System.Drawing.SystemColors.ActiveCaptionText
        Me.rbGv.Location = New System.Drawing.Point(182, 15)
        Me.rbGv.Name = "rbGv"
        Me.rbGv.Size = New System.Drawing.Size(102, 22)
        Me.rbGv.TabIndex = 2
        Me.rbGv.Text = "Gift Voucher"
        Me.rbGv.UseVisualStyleBackColor = False
        '
        'rbReturn
        '
        Me.rbReturn.AutoSize = True
        Me.rbReturn.BackColor = System.Drawing.Color.Transparent
        Me.rbReturn.ForeColor = System.Drawing.SystemColors.ActiveCaptionText
        Me.rbReturn.Location = New System.Drawing.Point(109, 15)
        Me.rbReturn.Name = "rbReturn"
        Me.rbReturn.Size = New System.Drawing.Size(68, 22)
        Me.rbReturn.TabIndex = 1
        Me.rbReturn.Text = "Return"
        Me.rbReturn.UseVisualStyleBackColor = False
        '
        'rbSale
        '
        Me.rbSale.AutoSize = True
        Me.rbSale.BackColor = System.Drawing.Color.Transparent
        Me.rbSale.ForeColor = System.Drawing.SystemColors.ActiveCaptionText
        Me.rbSale.Location = New System.Drawing.Point(55, 15)
        Me.rbSale.Name = "rbSale"
        Me.rbSale.Size = New System.Drawing.Size(52, 22)
        Me.rbSale.TabIndex = 0
        Me.rbSale.Text = "Sale"
        Me.rbSale.UseVisualStyleBackColor = False
        '
        'rbAll
        '
        Me.rbAll.AutoSize = True
        Me.rbAll.BackColor = System.Drawing.Color.Transparent
        Me.rbAll.Checked = True
        Me.rbAll.ForeColor = System.Drawing.SystemColors.ActiveCaptionText
        Me.rbAll.Location = New System.Drawing.Point(8, 15)
        Me.rbAll.Name = "rbAll"
        Me.rbAll.Size = New System.Drawing.Size(43, 22)
        Me.rbAll.TabIndex = 155
        Me.rbAll.TabStop = True
        Me.rbAll.Text = "All"
        Me.rbAll.UseVisualStyleBackColor = False
        '
        'tbToDate
        '
        Me.tbToDate.Format = System.Windows.Forms.DateTimePickerFormat.[Short]
        Me.tbToDate.Location = New System.Drawing.Point(112, 49)
        Me.tbToDate.Name = "tbToDate"
        Me.tbToDate.Size = New System.Drawing.Size(93, 26)
        Me.tbToDate.TabIndex = 156
        '
        'Label2
        '
        Me.Label2.AutoSize = True
        Me.Label2.BackColor = System.Drawing.Color.Transparent
        Me.Label2.ForeColor = System.Drawing.SystemColors.ActiveCaptionText
        Me.Label2.Location = New System.Drawing.Point(108, 4)
        Me.Label2.Name = "Label2"
        Me.Label2.Size = New System.Drawing.Size(54, 18)
        Me.Label2.TabIndex = 155
        Me.Label2.Text = "To Date"
        '
        'label4
        '
        Me.label4.AutoSize = True
        Me.label4.BackColor = System.Drawing.Color.Transparent
        Me.label4.ForeColor = System.Drawing.SystemColors.ActiveCaptionText
        Me.label4.Location = New System.Drawing.Point(207, 5)
        Me.label4.Name = "label4"
        Me.label4.Size = New System.Drawing.Size(75, 18)
        Me.label4.TabIndex = 157
        Me.label4.Text = "Showroom"
        '
        'Label3
        '
        Me.Label3.AutoSize = True
        Me.Label3.BackColor = System.Drawing.Color.Transparent
        Me.Label3.ForeColor = System.Drawing.SystemColors.ActiveCaptionText
        Me.Label3.Location = New System.Drawing.Point(382, 5)
        Me.Label3.Name = "Label3"
        Me.Label3.Size = New System.Drawing.Size(78, 18)
        Me.Label3.TabIndex = 158
        Me.Label3.Text = "Terminal ID"
        '
        'tbTerminal
        '
        Me.tbTerminal.BorderStyle = System.Windows.Forms.BorderStyle.FixedSingle
        Me.tbTerminal.Location = New System.Drawing.Point(384, 50)
        Me.tbTerminal.MaxLength = 2
        Me.tbTerminal.Name = "tbTerminal"
        Me.tbTerminal.Size = New System.Drawing.Size(81, 26)
        Me.tbTerminal.TabIndex = 159
        '
        'Label13
        '
        Me.Label13.BackColor = System.Drawing.Color.SteelBlue
        Me.Label13.Font = New System.Drawing.Font("Arial", 8.25!, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, CType(0, Byte))
        Me.Label13.ForeColor = System.Drawing.SystemColors.ControlLightLight
        Me.Label13.Location = New System.Drawing.Point(156, 624)
        Me.Label13.Name = "Label13"
        Me.Label13.Size = New System.Drawing.Size(35, 16)
        Me.Label13.TabIndex = 175
        Me.Label13.Text = "Cash:"
        '
        'tbCash
        '
        Me.tbCash.BackColor = System.Drawing.SystemColors.HighlightText
        Me.tbCash.ForeColor = System.Drawing.SystemColors.WindowText
        Me.tbCash.Location = New System.Drawing.Point(196, 620)
        Me.tbCash.Name = "tbCash"
        Me.tbCash.ReadOnly = True
        Me.tbCash.Size = New System.Drawing.Size(65, 26)
        Me.tbCash.TabIndex = 174
        Me.tbCash.Text = "0"
        Me.tbCash.TextAlign = System.Windows.Forms.HorizontalAlignment.Right
        '
        'Label14
        '
        Me.Label14.BackColor = System.Drawing.Color.SteelBlue
        Me.Label14.Font = New System.Drawing.Font("Arial", 8.25!, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, CType(0, Byte))
        Me.Label14.ForeColor = System.Drawing.SystemColors.ControlLightLight
        Me.Label14.Location = New System.Drawing.Point(265, 624)
        Me.Label14.Name = "Label14"
        Me.Label14.Size = New System.Drawing.Size(38, 16)
        Me.Label14.TabIndex = 177
        Me.Label14.Text = "Credit:"
        '
        'tbCredit
        '
        Me.tbCredit.BackColor = System.Drawing.SystemColors.HighlightText
        Me.tbCredit.ForeColor = System.Drawing.SystemColors.WindowText
        Me.tbCredit.Location = New System.Drawing.Point(317, 620)
        Me.tbCredit.Name = "tbCredit"
        Me.tbCredit.ReadOnly = True
        Me.tbCredit.Size = New System.Drawing.Size(65, 26)
        Me.tbCredit.TabIndex = 176
        Me.tbCredit.Text = "0"
        Me.tbCredit.TextAlign = System.Windows.Forms.HorizontalAlignment.Right
        '
        'Label15
        '
        Me.Label15.BackColor = System.Drawing.Color.SteelBlue
        Me.Label15.Font = New System.Drawing.Font("Arial", 8.25!, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, CType(0, Byte))
        Me.Label15.ForeColor = System.Drawing.SystemColors.ControlLightLight
        Me.Label15.Location = New System.Drawing.Point(382, 624)
        Me.Label15.Name = "Label15"
        Me.Label15.Size = New System.Drawing.Size(47, 16)
        Me.Label15.TabIndex = 179
        Me.Label15.Text = "Cheque:"
        '
        'tbCheque
        '
        Me.tbCheque.BackColor = System.Drawing.SystemColors.HighlightText
        Me.tbCheque.ForeColor = System.Drawing.SystemColors.WindowText
        Me.tbCheque.Location = New System.Drawing.Point(433, 620)
        Me.tbCheque.Name = "tbCheque"
        Me.tbCheque.ReadOnly = True
        Me.tbCheque.Size = New System.Drawing.Size(65, 26)
        Me.tbCheque.TabIndex = 178
        Me.tbCheque.Text = "0"
        Me.tbCheque.TextAlign = System.Windows.Forms.HorizontalAlignment.Right
        '
        'Label16
        '
        Me.Label16.BackColor = System.Drawing.Color.SteelBlue
        Me.Label16.Font = New System.Drawing.Font("Arial", 8.25!, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, CType(0, Byte))
        Me.Label16.ForeColor = System.Drawing.SystemColors.ControlLightLight
        Me.Label16.Location = New System.Drawing.Point(499, 624)
        Me.Label16.Name = "Label16"
        Me.Label16.Size = New System.Drawing.Size(35, 16)
        Me.Label16.TabIndex = 181
        Me.Label16.Text = "Knet:"
        '
        'tbKnet
        '
        Me.tbKnet.BackColor = System.Drawing.SystemColors.HighlightText
        Me.tbKnet.ForeColor = System.Drawing.SystemColors.WindowText
        Me.tbKnet.Location = New System.Drawing.Point(539, 620)
        Me.tbKnet.Name = "tbKnet"
        Me.tbKnet.ReadOnly = True
        Me.tbKnet.Size = New System.Drawing.Size(65, 26)
        Me.tbKnet.TabIndex = 180
        Me.tbKnet.Text = "0"
        Me.tbKnet.TextAlign = System.Windows.Forms.HorizontalAlignment.Right
        '
        'Label17
        '
        Me.Label17.BackColor = System.Drawing.Color.SteelBlue
        Me.Label17.Font = New System.Drawing.Font("Arial", 8.25!, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, CType(0, Byte))
        Me.Label17.ForeColor = System.Drawing.SystemColors.ControlLightLight
        Me.Label17.Location = New System.Drawing.Point(606, 624)
        Me.Label17.Name = "Label17"
        Me.Label17.Size = New System.Drawing.Size(49, 16)
        Me.Label17.TabIndex = 183
        Me.Label17.Text = "Cr.Card:"
        '
        'tbCard
        '
        Me.tbCard.BackColor = System.Drawing.SystemColors.HighlightText
        Me.tbCard.ForeColor = System.Drawing.SystemColors.WindowText
        Me.tbCard.Location = New System.Drawing.Point(662, 621)
        Me.tbCard.Name = "tbCard"
        Me.tbCard.ReadOnly = True
        Me.tbCard.Size = New System.Drawing.Size(65, 26)
        Me.tbCard.TabIndex = 182
        Me.tbCard.Text = "0"
        Me.tbCard.TextAlign = System.Windows.Forms.HorizontalAlignment.Right
        '
        'Label18
        '
        Me.Label18.BackColor = System.Drawing.Color.SteelBlue
        Me.Label18.Font = New System.Drawing.Font("Arial", 8.25!, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, CType(0, Byte))
        Me.Label18.ForeColor = System.Drawing.SystemColors.ControlLightLight
        Me.Label18.Location = New System.Drawing.Point(731, 624)
        Me.Label18.Name = "Label18"
        Me.Label18.Size = New System.Drawing.Size(26, 16)
        Me.Label18.TabIndex = 185
        Me.Label18.Text = "GV:"
        '
        'tbGV
        '
        Me.tbGV.BackColor = System.Drawing.SystemColors.HighlightText
        Me.tbGV.ForeColor = System.Drawing.SystemColors.WindowText
        Me.tbGV.Location = New System.Drawing.Point(756, 620)
        Me.tbGV.Name = "tbGV"
        Me.tbGV.ReadOnly = True
        Me.tbGV.Size = New System.Drawing.Size(65, 26)
        Me.tbGV.TabIndex = 184
        Me.tbGV.Text = "0"
        Me.tbGV.TextAlign = System.Windows.Forms.HorizontalAlignment.Right
        '
        'cmbShowroom
        '
        Me.cmbShowroom.DisplayMember = "Text"
        Me.cmbShowroom.DrawMode = System.Windows.Forms.DrawMode.OwnerDrawFixed
        Me.cmbShowroom.DropDownStyle = System.Windows.Forms.ComboBoxStyle.DropDownList
        Me.cmbShowroom.ItemHeight = 19
        Me.cmbShowroom.Location = New System.Drawing.Point(211, 50)
        Me.cmbShowroom.Name = "cmbShowroom"
        Me.cmbShowroom.Size = New System.Drawing.Size(164, 25)
        Me.cmbShowroom.TabIndex = 186
        '
        'cmdPrint
        '
        Me.cmdPrint.AccessibleRole = System.Windows.Forms.AccessibleRole.PushButton
        Me.cmdPrint.Font = New System.Drawing.Font("Calibri", 11.25!, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, CType(0, Byte))
        Me.cmdPrint.ForeColor = System.Drawing.Color.FromArgb(CType(CType(0, Byte), Integer), CType(CType(0, Byte), Integer), CType(CType(64, Byte), Integer))
        Me.cmdPrint.Location = New System.Drawing.Point(726, 527)
        Me.cmdPrint.Name = "cmdPrint"
        Me.cmdPrint.Size = New System.Drawing.Size(82, 27)
        Me.cmdPrint.TabIndex = 261
        Me.cmdPrint.Text = "Print"
        '
        'cmdRefresh
        '
        Me.cmdRefresh.AccessibleRole = System.Windows.Forms.AccessibleRole.PushButton
        Me.cmdRefresh.Font = New System.Drawing.Font("Calibri", 11.25!, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, CType(0, Byte))
        Me.cmdRefresh.ForeColor = System.Drawing.Color.FromArgb(CType(CType(0, Byte), Integer), CType(CType(0, Byte), Integer), CType(CType(64, Byte), Integer))
        Me.cmdRefresh.Location = New System.Drawing.Point(814, 527)
        Me.cmdRefresh.Name = "cmdRefresh"
        Me.cmdRefresh.Size = New System.Drawing.Size(82, 27)
        Me.cmdRefresh.TabIndex = 262
        Me.cmdRefresh.Text = "Refresh"
        '
        'cmdExit
        '
        Me.cmdExit.AccessibleRole = System.Windows.Forms.AccessibleRole.PushButton
        Me.cmdExit.Font = New System.Drawing.Font("Calibri", 11.25!, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, CType(0, Byte))
        Me.cmdExit.ForeColor = System.Drawing.Color.FromArgb(CType(CType(0, Byte), Integer), CType(CType(0, Byte), Integer), CType(CType(64, Byte), Integer))
        Me.cmdExit.Location = New System.Drawing.Point(902, 527)
        Me.cmdExit.Name = "cmdExit"
        Me.cmdExit.Size = New System.Drawing.Size(82, 27)
        Me.cmdExit.TabIndex = 260
        Me.cmdExit.Text = "Exit"
        '
        'GroupPanel1
        '
        Me.GroupPanel1.CanvasColor = System.Drawing.SystemColors.Control
        Me.GroupPanel1.ColorSchemeStyle = DevComponents.DotNetBar.eDotNetBarStyle.Office2007
        Me.GroupPanel1.Controls.Add(Me.GroupBox1)
        Me.GroupPanel1.Controls.Add(Me.Label3)
        Me.GroupPanel1.Controls.Add(Me.Label1)
        Me.GroupPanel1.Controls.Add(Me.Label2)
        Me.GroupPanel1.Controls.Add(Me.label4)
        Me.GroupPanel1.Dock = System.Windows.Forms.DockStyle.Fill
        Me.GroupPanel1.Location = New System.Drawing.Point(0, 0)
        Me.GroupPanel1.Name = "GroupPanel1"
        Me.GroupPanel1.Size = New System.Drawing.Size(996, 566)
        '
        '
        '
        Me.GroupPanel1.Style.BackColor2SchemePart = DevComponents.DotNetBar.eColorSchemePart.PanelBackground2
        Me.GroupPanel1.Style.BackColorGradientAngle = 90
        Me.GroupPanel1.Style.BackColorSchemePart = DevComponents.DotNetBar.eColorSchemePart.PanelBackground
        Me.GroupPanel1.Style.BorderBottom = DevComponents.DotNetBar.eStyleBorderType.Solid
        Me.GroupPanel1.Style.BorderBottomWidth = 1
        Me.GroupPanel1.Style.BorderColorSchemePart = DevComponents.DotNetBar.eColorSchemePart.PanelBorder
        Me.GroupPanel1.Style.BorderLeft = DevComponents.DotNetBar.eStyleBorderType.Solid
        Me.GroupPanel1.Style.BorderLeftWidth = 1
        Me.GroupPanel1.Style.BorderRight = DevComponents.DotNetBar.eStyleBorderType.Solid
        Me.GroupPanel1.Style.BorderRightWidth = 1
        Me.GroupPanel1.Style.BorderTop = DevComponents.DotNetBar.eStyleBorderType.Solid
        Me.GroupPanel1.Style.BorderTopWidth = 1
        Me.GroupPanel1.Style.CornerDiameter = 4
        Me.GroupPanel1.Style.CornerType = DevComponents.DotNetBar.eCornerType.Rounded
        Me.GroupPanel1.Style.TextAlignment = DevComponents.DotNetBar.eStyleTextAlignment.Center
        Me.GroupPanel1.Style.TextColorSchemePart = DevComponents.DotNetBar.eColorSchemePart.PanelText
        Me.GroupPanel1.Style.TextLineAlignment = DevComponents.DotNetBar.eStyleTextAlignment.Near
        Me.GroupPanel1.TabIndex = 263
        Me.GroupPanel1.Text = "Retail - Sales Summary Report"
        '
        'PosSalesSumamryRpt
        '
        Me.AutoScaleBaseSize = New System.Drawing.Size(7, 19)
        Me.BackColor = System.Drawing.SystemColors.ActiveCaption
        Me.ClientSize = New System.Drawing.Size(996, 566)
        Me.ControlBox = False
        Me.Controls.Add(Me.cmdPrint)
        Me.Controls.Add(Me.cmdRefresh)
        Me.Controls.Add(Me.cmdExit)
        Me.Controls.Add(Me.cmbShowroom)
        Me.Controls.Add(Me.tbTerminal)
        Me.Controls.Add(Me.tbGV)
        Me.Controls.Add(Me.tbCard)
        Me.Controls.Add(Me.tbKnet)
        Me.Controls.Add(Me.tbCheque)
        Me.Controls.Add(Me.tbCredit)
        Me.Controls.Add(Me.tbCash)
        Me.Controls.Add(Me.tbToDate)
        Me.Controls.Add(Me.tbFromDate)
        Me.Controls.Add(Me.dgProduct)
        Me.Controls.Add(Me.Label17)
        Me.Controls.Add(Me.Label16)
        Me.Controls.Add(Me.Label15)
        Me.Controls.Add(Me.Label14)
        Me.Controls.Add(Me.Label13)
        Me.Controls.Add(Me.Label18)
        Me.Controls.Add(Me.GroupPanel1)
        Me.Font = New System.Drawing.Font("Calibri", 11.25!, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, CType(0, Byte))
        Me.ForeColor = System.Drawing.SystemColors.ControlLightLight
        Me.FormBorderStyle = System.Windows.Forms.FormBorderStyle.FixedSingle
        Me.Location = New System.Drawing.Point(10, 15)
        Me.Name = "PosSalesSumamryRpt"
        Me.ShowInTaskbar = False
        Me.StartPosition = System.Windows.Forms.FormStartPosition.CenterParent
        CType(Me.dgProduct, System.ComponentModel.ISupportInitialize).EndInit()
        Me.GroupBox1.ResumeLayout(False)
        Me.GroupBox1.PerformLayout()
        Me.GroupPanel1.ResumeLayout(False)
        Me.GroupPanel1.PerformLayout()
        Me.ResumeLayout(False)
        Me.PerformLayout()

    End Sub

#End Region
    Public ShowroomID As Integer = ConfigurationManager.AppSettings("ShowroomID")
    Public WarehouseID As Integer = ConfigurationManager.AppSettings("WarehouseID")
    Public TerminalID As Integer = ConfigurationManager.AppSettings("TerminalID")
    Dim PrinterEnabled As Integer
    Dim PoleEnabled As Integer
    Dim DrawerEnabled As Integer
    Dim PosPrinterName As String
    Dim PolePrinterName As String

    Private Sub ICsavedInvSearch_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
        tbFromDate.Text = Now.ToShortDateString
        tbToDate.Text = Now.ToShortDateString

        Dim ICdata As New ICdataLogic
        Dim ds As DataSet
        ds = ICdata.GetCompanyShowrooms(3)
        cmbShowroom.DataSource = ds.Tables(0)
        cmbShowroom.ValueMember = "DepartmentID"
        cmbShowroom.DisplayMember = "DepartmentName"
        cmbShowroom.SelectedValue = 0

        Dim PosMode As DataSet
        PosMode = ICdata.GetPosMode(ShowroomID, TerminalID)
        PrinterEnabled = PosMode.Tables(0).Rows(0).Item("PrinterEnabled")
        PoleEnabled = PosMode.Tables(0).Rows(0).Item("PoleEnabled")
        DrawerEnabled = PosMode.Tables(0).Rows(0).Item("DrawerEnabled")
        PosPrinterName = PosMode.Tables(0).Rows(0).Item("PosPrinterName")
        PolePrinterName = PosMode.Tables(0).Rows(0).Item("PolePrinterName")
        ICdata = Nothing
    End Sub
    Private Sub GetSalesReport()
        Dim ICdata As New ICdataLogic
        Dim RptType As Integer = 0
        If rbAll.Checked = True Then
            RptType = 0
        End If
        If rbSale.Checked = True Then
            RptType = 1
        End If
        If rbReturn.Checked = True Then
            RptType = 2
        End If
        If rbGv.Checked = True Then
            RptType = 3
        End If
        Dim ds As DataSet
        Dim ds2 As DataSet
        Try
            ds = ICdata.GetRetailInvoiceSummary(cmbShowroom.SelectedValue, tbTerminal.Text, CashierID, tbFromDate.Text, tbToDate.Text, RptType)
        Catch ex As Exception
            MsgBox(ex.ToString)
            MsgBox("Invalid Date. Try Again.", MsgBoxStyle.Critical, "Inventory Manager")
            Exit Sub
        End Try
        If ds.Tables(0).Rows.Count = 0 Then
            MsgBox("No transaction for this period !", MsgBoxStyle.Critical, "Inventory Manager")
            Exit Sub
        End If
        Me.Cursor = Cursors.WaitCursor
        Dim dRow, dRow2 As DataRow
        Dim Cash, Credit, Cheque, Knet, Card, GV As Decimal
        Dim Gross, Disc, Net As Decimal
        For Each dRow In ds.Tables(0).Rows
            Dim InvDay, InvMonth, InvYear As String
            InvDay = dRow("InvDay").ToString()
            InvMonth = dRow("InvMonth").ToString()
            InvYear = dRow("InvYear").ToString
            If InvMonth.Trim.Length = 1 Then
                InvMonth = "0" + InvMonth
            End If
            If InvDay.Trim.Length = 1 Then
                InvDay = "0" + InvDay
            End If
            dRow("InvDateTime") = InvDay + "-" + InvMonth + "-" + InvYear
            Dim CashPaid As Double
            CashPaid = dRow("InvNet") - (dRow("InvCrAmt") + dRow("InvGvValue") + dRow("InvChqAmt") + dRow("InvKnetAmt") + dRow("InvCardAmt"))
            Cash += CashPaid
            dRow("InvCashPaid") = CashPaid.ToString("#0.000")
            If IsNumeric(dRow("InvCrAmt")) Then
                Credit += CDbl(dRow("InvCrAmt"))
                dRow("InvCrAmt") = CDbl(dRow("InvCrAmt")).ToString("#0.000")
            End If
            If IsNumeric(dRow("InvGvValue")) Then
                GV += CDbl(dRow("InvGvValue"))
                dRow("InvGvValue") = CDbl(dRow("InvGvValue")).ToString("#0.000")
            End If
            If IsNumeric(dRow("InvChqAmt")) Then
                Cheque += CDbl(dRow("InvChqAmt"))
                dRow("InvChqAmt") = CDbl(dRow("InvChqAmt")).ToString("#0.000")
            End If
            If IsNumeric(dRow("InvKnetAmt")) Then
                Knet += CDbl(dRow("InvKnetAmt"))
                dRow("InvKnetAmt") = CDbl(dRow("InvKnetAmt")).ToString("#0.000")
            End If
            If IsNumeric(dRow("InvCardAmt")) Then
                Card += CDbl(dRow("InvCardAmt"))
                dRow("InvCardAmt") = CDbl(dRow("InvCardAmt")).ToString("#0.000")
            End If
            If IsNumeric(dRow("InvGrossAmt")) Then
                Gross += CDbl(dRow("InvGrossAmt"))
                dRow("InvGrossAmt") = CDbl(dRow("InvGrossAmt")).ToString("#0.000")
            End If
            If IsNumeric(dRow("InvGda")) Then
                Disc += CDbl(dRow("InvGda"))
                dRow("InvGda") = CDbl(dRow("InvGda")).ToString("#0.000")
            End If
            If IsNumeric(dRow("InvNet")) Then
                Net += CDbl(dRow("InvNet"))
                dRow("InvNet") = CDbl(dRow("InvNet")).ToString("#0.000")
            End If
        Next
        dRow = ds.Tables(0).NewRow()
        dRow("InvDateTime") = "TOTAL:"
        dRow("InvGrossAmt") = Gross.ToString("#0.000")
        dRow("InvGda") = Disc.ToString("#0.000")
        dRow("InvNet") = Net.ToString("#0.000")
        dRow("InvCrAmt") = Credit.ToString("#0.000")
        dRow("InvGvValue") = GV.ToString("#0.000")
        dRow("InvChqAmt") = Cheque.ToString("#0.000")
        dRow("InvKnetAmt") = Knet.ToString("#0.000")
        dRow("InvCardAmt") = Card.ToString("#0.000")
        dRow("InvCashPaid") = Cash.ToString("#0.000")
        ds.Tables(0).Rows.Add(dRow)
        dgProduct.DataSource = ds.Tables(0)
        With dgProduct
            ' .BackgroundColor = GridBackgroundColor
            .TableStyles.Clear()
            .CaptionBackColor = System.Drawing.Color.SlateBlue
            .CaptionForeColor = System.Drawing.Color.LemonChiffon
            .AllowSorting = True
            .AlternatingBackColor = System.Drawing.Color.AliceBlue
            .ParentRowsBackColor = System.Drawing.Color.Lavender
            .ParentRowsForeColor = System.Drawing.Color.SlateBlue
            .HeaderBackColor = System.Drawing.Color.LemonChiffon
            .AllowNavigation = False
            .ParentRowsVisible = False
            .RowHeadersVisible = False
        End With

        Dim cm As CurrencyManager = BindingContext(dgProduct.DataSource, dgProduct.DataMember)
        Dim dv As DataView = cm.List
        dv.AllowNew = False
        dgformat(ds.Tables(0).Rows.Count)
        If ds.Tables(0).Rows.Count > 0 Then
            dgProduct.Select(dgProduct.CurrentRowIndex())
        End If
        Me.Cursor = Cursors.Default

    End Sub
    Private Sub dgformat(ByVal RowCount As Integer)
        Dim grdTableStyle As New DataGridTableStyle
        With grdTableStyle
            .AlternatingBackColor = Color.AliceBlue
            .HeaderFont = New Font("Tahoma", 8.0!, FontStyle.Bold)
            .MappingName = "INVOICE"
            .PreferredColumnWidth = 160
            .HeaderBackColor = Color.LightSlateGray
            .HeaderForeColor = Color.LightCyan
            .PreferredRowHeight = 15
            .RowHeadersVisible = False
            .RowHeaderWidth = 0
        End With
        Dim cs1 As DataGridColumnStyle
        cs1 = New DataGridTextBoxColumn
        cs1.Width = 120
        cs1.MappingName = "INVDATETIME"
        cs1.HeaderText = "DATE"
        cs1.NullText = ""
        cs1.ReadOnly = True
        grdTableStyle.GridColumnStyles.Add(cs1)
        '
        cs1 = New DataGridTextBoxColumn
        cs1.Width = 90
        cs1.MappingName = "INVGROSSAMT"
        cs1.HeaderText = "GROSS AMT"
        cs1.NullText = ""
        cs1.ReadOnly = True
        cs1.Alignment = HorizontalAlignment.Right
        grdTableStyle.GridColumnStyles.Add(cs1)
        '
        cs1 = New DataGridTextBoxColumn
        cs1.Width = 70
        cs1.MappingName = "INVGDA"
        cs1.HeaderText = "DIS.AMT"
        cs1.NullText = ""
        cs1.ReadOnly = True
        cs1.Alignment = HorizontalAlignment.Right
        grdTableStyle.GridColumnStyles.Add(cs1)
        '
        cs1 = New DataGridTextBoxColumn
        cs1.Width = 80
        cs1.MappingName = "INVNET"
        cs1.HeaderText = "NET AMT"
        cs1.NullText = ""
        cs1.ReadOnly = True
        cs1.Alignment = HorizontalAlignment.Right
        grdTableStyle.GridColumnStyles.Add(cs1)
        '
        cs1 = New DataGridTextBoxColumn
        cs1.Width = 70
        cs1.MappingName = "INVCASHPAID"
        cs1.HeaderText = "CASH"
        cs1.NullText = ""
        cs1.ReadOnly = True
        cs1.Alignment = HorizontalAlignment.Right
        grdTableStyle.GridColumnStyles.Add(cs1)
        '
        cs1 = New DataGridTextBoxColumn
        cs1.Width = 70
        cs1.MappingName = "INVCRAMT"
        cs1.HeaderText = "CREDIT"
        cs1.NullText = ""
        cs1.ReadOnly = True
        cs1.Alignment = HorizontalAlignment.Right
        grdTableStyle.GridColumnStyles.Add(cs1)
        '
        cs1 = New DataGridTextBoxColumn
        cs1.Width = 70
        cs1.MappingName = "INVCHQAMT"
        cs1.HeaderText = "CHEQUE"
        cs1.NullText = ""
        cs1.ReadOnly = True
        cs1.Alignment = HorizontalAlignment.Right
        grdTableStyle.GridColumnStyles.Add(cs1)
        '
        cs1 = New DataGridTextBoxColumn
        cs1.Width = 70
        cs1.MappingName = "INVKNETAMT"
        cs1.HeaderText = "KNET"
        cs1.NullText = ""
        cs1.ReadOnly = True
        cs1.Alignment = HorizontalAlignment.Right
        grdTableStyle.GridColumnStyles.Add(cs1)
        '
        cs1 = New DataGridTextBoxColumn
        cs1.Width = 70
        cs1.MappingName = "INVCARDAMT"
        cs1.HeaderText = "CR.CARD"
        cs1.NullText = ""
        cs1.ReadOnly = True
        cs1.Alignment = HorizontalAlignment.Right
        grdTableStyle.GridColumnStyles.Add(cs1)
        '
        cs1 = New DataGridTextBoxColumn
        cs1.Width = 70
        cs1.MappingName = "INVGVVALUE"
        cs1.HeaderText = "GV.AMT"
        cs1.NullText = ""
        cs1.ReadOnly = True
        cs1.Alignment = HorizontalAlignment.Right
        grdTableStyle.GridColumnStyles.Add(cs1)
        '
        dgProduct.TableStyles.Add(grdTableStyle)
    End Sub

    Private Sub cmdExit_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles cmdExit.Click
        Me.Close()
    End Sub

    Private Sub dgProduct_MouseUp(ByVal sender As Object, ByVal e As System.Windows.Forms.MouseEventArgs) Handles dgProduct.MouseUp
        Dim pt As New Point(e.X, e.Y)
        Dim hti As DataGrid.HitTestInfo = dgProduct.HitTest(pt)
        If hti.Type = DataGrid.HitTestType.Cell Then
            dgProduct.CurrentCell = New DataGridCell(hti.Row, hti.Column)
            dgProduct.Select(hti.Row)
        End If
    End Sub
    Private Sub cmdRefresh_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles cmdRefresh.Click
        GetSalesReport()
    End Sub
    Private Sub cmdPrint_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles cmdPrint.Click
        PrintOnA4()
    End Sub
    Private Sub PrintOnA4()
        Me.Cursor = Cursors.WaitCursor
        Dim ds As DataSet = New DataSet("SerpsRpt")
        Dim table As DataTable = New DataTable("SerpsRpt")
        table.Columns.Add("Str1")
        table.Columns.Add("Str2")
        table.Columns.Add("Str3")
        table.Columns.Add("Str4")
        table.Columns.Add("Str5")
        table.Columns.Add("Str6")
        table.Columns.Add("Str7")
        table.Columns.Add("Str8")
        table.Columns.Add("Str9")
        table.Columns.Add("Str10")
        table.Columns.Add("Int1")
        table.Columns.Add("Int2")
        table.Columns.Add("Int3")
        table.Columns.Add("Int4")
        table.Columns.Add("Int5")
        table.Columns.Add("Int6")
        table.Columns.Add("Int7")
        table.Columns.Add("Int8")
        table.Columns.Add("Int9")
        table.Columns.Add("Int10")
        table.Columns.Add("Dec1")
        table.Columns.Add("Dec2")
        table.Columns.Add("Dec3")
        table.Columns.Add("Dec4")
        table.Columns.Add("Dec5")
        table.Columns.Add("Dec6")
        table.Columns.Add("Dec7")
        table.Columns.Add("Dec8")
        table.Columns.Add("Dec9")
        table.Columns.Add("Dec10")

        Dim indate As String

        Dim mrow, drow As Integer
        Dim cm As CurrencyManager = BindingContext(dgProduct.DataSource, dgProduct.DataMember)
        Dim dv As DataView = cm.List
        dv.RowStateFilter = DataViewRowState.CurrentRows
        'If dv.Count = 0 Then
        '    GetSalesReport()
        'End If
        mrow = dv.Count
        Dim n As Integer
        For n = 0 To mrow - 1
            Dim nrow As DataRow = table.NewRow()
            nrow("Str1") = dgProduct.Item(n, 0)
            nrow("Dec1") = dgProduct.Item(n, 1)
            nrow("Dec2") = dgProduct.Item(n, 2)
            nrow("Dec3") = dgProduct.Item(n, 3)
            nrow("Dec4") = dgProduct.Item(n, 4)
            nrow("Dec5") = dgProduct.Item(n, 5)
            nrow("Dec6") = dgProduct.Item(n, 6)
            nrow("Dec7") = dgProduct.Item(n, 7)
            nrow("Dec8") = dgProduct.Item(n, 8)
            nrow("Dec9") = dgProduct.Item(n, 9)
            table.Rows.Add(nrow)
        Next
        ds.Tables.Add(table)

        retailDetialSales1.Load()
        retailDetialSales1.SetDataSource(ds)

        Dim rptype As String
        If rbAll.Checked = True Then
            rptype = "ALL"
        End If
        If rbSale.Checked = True Then
            rptype = "SALES"
        End If
        If rbReturn.Checked = True Then
            rptype = "RETURNS"
        End If
        If rbGv.Checked = True Then
            rptype = "GIFT VOUCHERS"
        End If

        retailDetialSales1.SetParameterValue("CompName", CompanyTitle)
        retailDetialSales1.SetParameterValue("ReportName", "Daily Sales Summary Report")
        retailDetialSales1.SetParameterValue("FromDate", tbFromDate.Text)
        retailDetialSales1.SetParameterValue("ToDate", tbToDate.Text)
        retailDetialSales1.SetParameterValue("ShowroomName", cmbShowroom.Text)
        retailDetialSales1.SetParameterValue("ReportType", rptype)
        retailDetialSales1.SetParameterValue("TerminalID", tbTerminal.Text)

        If PrntPrv Is Nothing Then
            PrntPrv = New PrintPreviewForm
            PrntPrv.CrRptView.ReportSource = retailDetialSales1
            PrntPrv.ShowDialog()
        End If
        'retaildetailsales1.PrintOptions.PrinterName = InvoicePrinter
        'Try
        '    retaildetailsales1.PrintToPrinter(1, True, 0, 0)
        'Catch ex As Exception
        '    MsgBox(ex.ToString)
        'End Try
        retailDetialSales1.Close()
        Me.Cursor = Cursors.Default
    End Sub
    Private Sub PrintOnReceipt()
        Me.Cursor = Cursors.WaitCursor
        '
        PrintInvoiceHeader()
        '
        Dim mrow, drow As Integer
        Dim cm As CurrencyManager = BindingContext(dgProduct.DataSource, dgProduct.DataMember)
        Dim dv As DataView = cm.List
        dv.RowStateFilter = DataViewRowState.CurrentRows
        mrow = dv.Count
        Dim n As Integer
        Dim Cash As Decimal = 0.0
        Dim Credit As Decimal = 0.0
        Dim Chq As Decimal = 0.0
        Dim Knet As Decimal = 0.0
        Dim Card As Decimal = 0.0
        Dim GV As Decimal = 0.0
        Dim InvTotal As Decimal = 0.0
        For n = 0 To mrow - 1
            Dim InvoiceNo As String = ""
            Dim Amount As String = ""
            Dim Desc As String = ""
            InvoiceNo = dgProduct.Item(n, 2)
            Amount = dgProduct.Item(n, 6)
            InvTotal += Decimal.Parse(Amount)
            If Decimal.Parse(Amount) < 0 Then
                Desc = "Return"
            Else
                Desc = "Sale"
            End If
            '
            PrintInvoiceLine(InvoiceNo, Desc, Amount)
            '
            If IsNumeric(dgProduct.Item(n, 7)) Then
                Cash += Decimal.Parse(dgProduct.Item(n, 7))
            End If
            If IsNumeric(dgProduct.Item(n, 8)) Then
                Credit += Decimal.Parse(dgProduct.Item(n, 8))
            End If
            If IsNumeric(dgProduct.Item(n, 9)) Then
                Chq += Decimal.Parse(dgProduct.Item(n, 9))
            End If
            If IsNumeric(dgProduct.Item(n, 10)) Then
                Knet += Decimal.Parse(dgProduct.Item(n, 10))
            End If
            If IsNumeric(dgProduct.Item(n, 11)) Then
                Card += Decimal.Parse(dgProduct.Item(n, 11))
            End If
            If IsNumeric(dgProduct.Item(n, 12)) Then
                GV += Decimal.Parse(dgProduct.Item(n, 12))
            End If
        Next
        PrintInvoiceFooter(InvTotal, Cash, Credit, Chq, Knet, Card, GV)
        Me.Cursor = Cursors.Default
    End Sub
    Private Sub PrintInvoiceHeader()
        Dim s As String
        Dim CompName As String = ConfigurationManager.AppSettings("CompName")
        Dim CompAddr As String = ConfigurationManager.AppSettings("CompAddr")
        Dim CompTel As String = ConfigurationManager.AppSettings("CompTel")
        Dim BoldCharsOn, BoldCharsOff As String
        '
        PrintDialog1.PrinterSettings = New PrinterSettings
        PrintDialog1.PrinterSettings.PrinterName = PosPrinterName
        BoldCharsOn = Chr(27) + Chr(69)
        BoldCharsOff = Chr(27) + Chr(70)
        s = BoldCharsOn + Space((40 - CompName.Trim.Length) / 2) & CompName.Trim & vbLf + BoldCharsOff

        Try
            If PrinterEnabled = 1 Then
                RawPrinterHelper.SendStringToPrinter(PrintDialog1.PrinterSettings.PrinterName, s)
                s = "POS#:" & TerminalID.ToString() & Space(5) & "Cashier:" & UserID.ToString() & vbLf
                RawPrinterHelper.SendStringToPrinter(PrintDialog1.PrinterSettings.PrinterName, s)
                s = "Date:" & Now.ToString("dd/MM/yyyy") & Space(5) & "Time:" & Now.ToShortTimeString & vbLf
                RawPrinterHelper.SendStringToPrinter(PrintDialog1.PrinterSettings.PrinterName, s)
                s = " SUMMARY"
                Dim rptype As String
                If rbAll.Checked = True Then
                    rptype = "SALE/RETURN/GV"
                End If
                If rbSale.Checked = True Then
                    rptype = "SALE"
                End If
                If rbReturn.Checked = True Then
                    rptype = "RETURN"
                End If
                If rbGv.Checked = True Then
                    rptype = "GIFT VOUCHER"
                End If
                s = rptype + s
                s = BoldCharsOn + Space((40 - s.Trim.Length) / 2) & s.Trim & vbLf + BoldCharsOff
                RawPrinterHelper.SendStringToPrinter(PrintDialog1.PrinterSettings.PrinterName, s)
                s = "-"
                s = s.PadRight(40, "-") & vbLf
                RawPrinterHelper.SendStringToPrinter(PrintDialog1.PrinterSettings.PrinterName, s)
                s = "Receipt No." & Space(23) & "Amount" & vbLf
                RawPrinterHelper.SendStringToPrinter(PrintDialog1.PrinterSettings.PrinterName, s)
                s = "-"
                s = s.PadRight(40, "-") & vbLf
                RawPrinterHelper.SendStringToPrinter(PrintDialog1.PrinterSettings.PrinterName, s)
            End If
        Catch ex As Exception
            MsgBox(ex.ToString())
        End Try
    End Sub
    Private Sub PrintInvoiceLine(ByVal Invoice As String, ByVal Desc As String, ByVal Amount As String)
        Dim prndesc As String
        Dim RedCharsOn, RedCharsOff, OpenDrawChar As String
        RedCharsOn = Chr(27) + Chr(52)
        RedCharsOff = Chr(27) + Chr(53)
        If Desc.Length > 25 Then
            prndesc = Desc.Substring(0, 25)
        Else
            prndesc = Desc
        End If
        Dim prnqty As String
        Dim prntotal As String
        Dim s As String = ""
        s = Invoice.Trim & Space(3) & Space(25 - Desc.Trim.Length) & Desc.Trim & Space(9 - Amount.Trim.Length) & Amount.Trim & vbLf
        PrintDialog1.PrinterSettings = New PrinterSettings
        PrintDialog1.PrinterSettings.PrinterName = PosPrinterName
        If PrinterEnabled = 1 Then
            RawPrinterHelper.SendStringToPrinter(PrintDialog1.PrinterSettings.PrinterName, s)
        End If
    End Sub
    Private Sub PrintInvoiceFooter(ByVal InvTotal As String, ByVal Cash As String, ByVal Credit As String, ByVal Chq As String, ByVal Knet As String, ByVal Card As String, ByVal GV As String)
        PrintDialog1.PrinterSettings = New PrinterSettings
        PrintDialog1.PrinterSettings.PrinterName = PosPrinterName
        Dim RedCharsOn, RedCharsOff, OpenDrawChar As String
        RedCharsOn = Chr(27) + Chr(52)
        RedCharsOff = Chr(27) + Chr(53)
        OpenDrawChar = Chr(7)
        If PrinterEnabled = 1 Then
            Dim s As String
            s = "-"
            s = vbLf & Space(21) & RedCharsOn & "Total:" & Space(13) & InvTotal.Trim & RedCharsOff & vbLf
            RawPrinterHelper.SendStringToPrinter(PrintDialog1.PrinterSettings.PrinterName, s)
            s = "-"
            s = vbLf & s.PadRight(40, "-") & vbLf
            RawPrinterHelper.SendStringToPrinter(PrintDialog1.PrinterSettings.PrinterName, s)
            s = "Cash: " & Cash & vbLf
            RawPrinterHelper.SendStringToPrinter(PrintDialog1.PrinterSettings.PrinterName, s)
            s = "Credit: " & Credit & vbLf
            RawPrinterHelper.SendStringToPrinter(PrintDialog1.PrinterSettings.PrinterName, s)
            s = "KNET: " & Knet & vbLf
            RawPrinterHelper.SendStringToPrinter(PrintDialog1.PrinterSettings.PrinterName, s)
            s = "GV: " & GV & vbLf
            RawPrinterHelper.SendStringToPrinter(PrintDialog1.PrinterSettings.PrinterName, s)
            s = "Cheque: " & Chq & vbLf
            RawPrinterHelper.SendStringToPrinter(PrintDialog1.PrinterSettings.PrinterName, s)
            s = "Cr.Card: " & Card & vbLf
            RawPrinterHelper.SendStringToPrinter(PrintDialog1.PrinterSettings.PrinterName, s)
            s = "-"
            s = vbLf & s.PadRight(40, "-") & vbLf
            RawPrinterHelper.SendStringToPrinter(PrintDialog1.PrinterSettings.PrinterName, s)
            Dim mtot As Decimal = 0.0
            mtot = Decimal.Parse(Cash) + Decimal.Parse(Chq) + Decimal.Parse(Knet) + Decimal.Parse(Card) + Decimal.Parse(Credit) + Decimal.Parse(GV)
            s = vbLf & Space(21) & RedCharsOn & "Total:" & Space(13) & mtot.ToString() & RedCharsOff & vbLf
            RawPrinterHelper.SendStringToPrinter(PrintDialog1.PrinterSettings.PrinterName, s)
            s = "-"
            s = vbLf & s.PadRight(40, "-") & vbLf
            RawPrinterHelper.SendStringToPrinter(PrintDialog1.PrinterSettings.PrinterName, s)
            s = " "
            s = s.PadRight(40, " ") & vbLf
            RawPrinterHelper.SendStringToPrinter(PrintDialog1.PrinterSettings.PrinterName, s)
            s = " "
            s = s.PadRight(40, " ") & vbLf
            RawPrinterHelper.SendStringToPrinter(PrintDialog1.PrinterSettings.PrinterName, s)
            s = " "
            s = s.PadRight(40, " ") & vbLf
            RawPrinterHelper.SendStringToPrinter(PrintDialog1.PrinterSettings.PrinterName, s)
            s = " "
            s = s.PadRight(40, " ") & vbLf
            RawPrinterHelper.SendStringToPrinter(PrintDialog1.PrinterSettings.PrinterName, s)
            s = " "
            s = s.PadRight(40, " ") & vbLf
            RawPrinterHelper.SendStringToPrinter(PrintDialog1.PrinterSettings.PrinterName, s)
            s = " "
            s = s.PadRight(40, " ") & vbLf
            RawPrinterHelper.SendStringToPrinter(PrintDialog1.PrinterSettings.PrinterName, s)
            s = " "
            s = s.PadRight(40, " ") & vbLf
            RawPrinterHelper.SendStringToPrinter(PrintDialog1.PrinterSettings.PrinterName, s)
        End If
    End Sub

End Class
